new IScroll(".home",{
		click:true
	});


var arr = ['yunqian','yunzhong','chanqian'];
var Datas = null;
console.log(Datas)
$.ajax({
    url:"http://localhost/yvyv/data.json",
    dataType:"json",
    type:'get',
    success:function(data){
        Datas = data
    }
})


 function ajax(opt) {
        opt = opt || {};
        opt.method = opt.method.toUpperCase() || 'POST';
        opt.url = opt.url || '';
        opt.async = opt.async || true;
        opt.data = opt.data || null;
        opt.success = opt.success || function () {};
        var xmlHttp = null;
        if (XMLHttpRequest) {
            xmlHttp = new XMLHttpRequest();
        }
        else {
            xmlHttp = new ActiveXObject('Microsoft.XMLHTTP');
        }
        var params = [];
        for (var key in opt.data){
            // 枚举opt.data;
            params.push(key + '=' + opt.data[key]);
        }
        var postData = params.join('&');
        
        if (opt.method.toUpperCase() === 'POST') {
            xmlHttp.open(opt.method, opt.url, opt.async);
            xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded;charset=utf-8');
            xmlHttp.send(postData);
        }
        else if (opt.method.toUpperCase() === 'GET') {
            xmlHttp.open(opt.method, opt.url + '?' + postData, opt.async);
            xmlHttp.send(null);
        } 
        xmlHttp.onreadystatechange = function () {
            if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
                opt.success(xmlHttp.responseText);
            }
        };
    }
    console.log(Datas)
    ajax({
        method: 'GET',
        url: 'http://localhost/yvyv/data.json',
        data: {
            name1: 'value1',
            name2: 'value2'
        },
        success: function (response) {
           // console.log(response)
            // console.log(JSON.parse(response))
            var data = JSON.parse(response)
            Datas=data;



        // // var list=document.querySelector("#list")
        // // console.log(Datas.chanhou.fenlei)
        // var str="";
        // var erji=Datas.chanhou.fenlei;
    
        //     // str+='<a href="#article" data-content="'+id+'_'+index+'"><img src="img/tu/'+val.img+'" alt=""><p>'+val.title+'</p></a>'
        //         // console.log(erji[0].img);
        //         for (var i=0;i<erji.length;i++) {
        //             str+='<a href="#article"><img src="img/tu/'+erji[i].img+'"><p>'+erji[i].title+'</p></a>';
        //             // console.log(str);
                
        //         }
        //         $(".list-content").append(str);
        //         // console.log(str)



        // console.log(str)

        console.log(Datas)












        }

});
http://localhost/yvyv/data.json






















var arr = ['yunqian','yunzhong','chanqian'];


		$(".box").on('click','a',function(e){
			 e.preventDefault();
			var that=$(this).attr('href');
			
			// console.log(that)
			
            var id=$(this).attr("id");
             echo.init({
                offset:0,
                target:1000
            });
            $(that).css({
                    transition:'all .3s',
                    transform:'translateX(0)'
                }).siblings().css({
                    transform:'translateX(100%)'
                }) 
			if (e.target.parentNode.nodeName=='NAV') {
				
				var index=$(this).index();
				$("mark").animate({
						left:index*25+"%"
				})



				
				
			}
			

            inTo($(this));
			
            if( that =='#list'){
                //进入列表页
                getId(id);
            }else if(that=='#article'){
                //进入内容页
                getContent($(this));            }


			


			
		})
		function inTo(that){

		var href=that.attr("href");
		// console.log(that); 
  //       console.log(that.attr);
  //       console.log(href);
        console.log(href)
		if (href=="#home") {
			// alert(1);
          // 
			console.log(href)
            $(".fan").hide();
            console.log(href)
		}else if(href=="#list"){
            $(".fan").show();
            $(".return").attr("href","#home");
			}

		}




        function inTo(that){

        var href = that.attr("href");
        if(href=='#list'){
            $(".fan").attr("href",'#home');
            $(".fan").show();
            $(".fav").hide();
        }else if(href=='#home'){
            $(".fan").hide();
        }else if(href=='#article'){
            $(".fav").hide();

            $(".fan").attr('href','#list');
        }

}   

        



function getId(id){
    if($.inArray(id,arr)>-1){
        getload(id)
    }
}
function getload(id){
    var str="";
    list.append(str)
    
}

function getContent(el){
    console.log(el.data("content")) 
    var arr = el.data("content").split("_");

    $("#article").html(
       Datas[arr[0]]['fenlei'][arr[1]].content
    )
    $('h1').text( Datas[arr[0]]['fenlei'][arr[1]].title   )

}























